<?php

namespace Database\Seeders;

use Carbon\Carbon;
use App\Models\User;
use App\Models\Bonus;
use Illuminate\Database\Seeder;

class UserSeeder extends Seeder
{
    public function run()
    {
	    User::factory()->count(24)->create();
	    
	    $user = User::find(1);
	    $user->parent_id = 0;
	    $user->grade = 'vip';
	    $user->save();
	
	    $user = User::find(2);
	    $user->grade = 'vip';
	    $user->parent_id = 1;
	    $user->name = '吕宙';
	    $user->password = bcrypt('000000');
	    $user->phone = '13301240253';
	    $user->invite_code = '2233445566';
	    $user->save();
	
	    $user->addresses()->create([
		    'contact_name' => '吕宙',
		    'contact_phone' => '13301240253',
		    'province' => '110000',
		    'city' => '110100',
		    'district' => '110105',
		    'address' => '建外SOHO',
		    'is_default' => true,
	    ]);
	
	    $user = User::create([
	    	'id' => 22535,
		    'grade' => 'vip',
		    'name' => 'Rainsen Martin',
		    'password' => bcrypt('000000'),
		    'phone' => '18888888888',
		    'invite_code' => '1122334455',
		    'avatar' => 'https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTI3TZ4PXGvNIevwkpiaaRaQtxw3enBNJjCK0pBkUEFW0IjiaiaHs381tWqfjJIiaibbLmWobwT3rweoYNQ/132',
		    'gender' => 'male',
		    'wm_openid' => 'o_P0m5ck4Aja5J0d2hGfYcPNkDTg',
		    'wm_session_key' => '3Db+kPUl63ZYIF9uhaAYfw==',
		    'wx_unionid' => 'oYfVK5qwQK73J8647xunZp_YK6FM',
		    'alipay_user_id' => '1'
	    ]);
	
	    $user->addresses()->create([
		    'contact_name' => '大雨',
		    'contact_phone' => '18888888888',
		    'province' => '110000',
		    'city' => '110100',
		    'district' => '110105',
		    'address' => '建外SOHO',
		    'is_default' => true
	    ]);
	    $user->addresses()->create([
		    'contact_name' => '中雨',
		    'contact_phone' => '18888888888',
		    'province' => '110000',
		    'city' => '110100',
		    'district' => '110105',
		    'address' => '长安街',
		    'is_default' => false
	    ]);
    }
}
